package cn.iocoder.yudao.module.bpm.dal.mysql.formdefinition;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.dal.dataobject.formdefinition.FormDefinitionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.bpm.controller.admin.formdefinition.vo.*;

/**
 * 表单定义 Mapper
 *
 * @author admin
 */
@Mapper
public interface FormDefinitionMapper extends BaseMapperX<FormDefinitionDO> {

    default PageResult<FormDefinitionDO> selectPage(FormDefinitionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FormDefinitionDO>()
                .likeIfPresent(FormDefinitionDO::getFormName, reqVO.getFormName())
                .eqIfPresent(FormDefinitionDO::getFormDef, reqVO.getFormDef())
                .eqIfPresent(FormDefinitionDO::getFormType, reqVO.getFormType())
                .eqIfPresent(FormDefinitionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(FormDefinitionDO::getRemark, reqVO.getRemark())
                .eqIfPresent(FormDefinitionDO::getConfig, reqVO.getConfig())
                .betweenIfPresent(FormDefinitionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FormDefinitionDO::getId));
    }

    default List<FormDefinitionDO> selectList(FormDefinitionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FormDefinitionDO>()
                .likeIfPresent(FormDefinitionDO::getFormName, reqVO.getFormName())
                .eqIfPresent(FormDefinitionDO::getFormDef, reqVO.getFormDef())
                .eqIfPresent(FormDefinitionDO::getFormType, reqVO.getFormType())
                .eqIfPresent(FormDefinitionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(FormDefinitionDO::getRemark, reqVO.getRemark())
                .eqIfPresent(FormDefinitionDO::getConfig, reqVO.getConfig())
                .betweenIfPresent(FormDefinitionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FormDefinitionDO::getId));
    }

}
